<?php
/**
 * Smart Library - Smart Framework
 * http://smart-framework.highet.eu
 *
 * @category   SmartL
 * @package    SmartL_Zend
 * @subpackage Controller
 * @copyright  Copyright (c) 2005-2008 Smart Framework team - Stepan Sindelar, Vojtech Vit
 * @license    http://www.opensource.org/licenses/bsd-license.php	New BSD License
 */

/**
 * Messenger class for configuration of caching of action. 
 *
 * @package SmartL_Zend
 * @subpackage Controller
 */
class SmartL_Zend_Controller_Action_Config_ActionInfo_CacheInfo {
	private $_cacheAdapterName;
	private $_disabled;
	private $_specificLifetime;
	private $_cacheIdRules;
	private $_cacheTags;
	
	/**
	 * @param string $cacheAdapterName Name of specific cache adapter.
	 * @param boolean $disabled Is caching of this action disabled.
	 * @param integer $specificLifetime Specific lifetime for this cache.
	 * @param array $cacheIdRules Array of cacheIdRules config. See method getCacheIdRules for more info.
	 * @param array[]=>string $cacheTags Tags for this cache.
	 */
	public function __construct($cacheAdapterName, $disabled, $specificLifetime, array $cacheIdRules, array $cacheTags=array()) {
		$this->_cacheAdapterName = $cacheAdapterName;
		$this->_disabled = $disabled;
		$this->_specificLifetime = $specificLifetime;
		$this->_cacheIdRules = $cacheIdRules;
		$this->_cacheTags = $cacheTags;
	}
	
	/**
	 * Name of specific cache adapter.
	 *
	 * @return string|null
	 */
	public function getCacheAdapterName() {
		return $this->_cacheAdapterName;
	}
	
	/**
	 * @return boolean
	 */
	public function isDisabled() {
		return $this->_disabled;
	}
	
	/**
	 * @return integer|null
	 */
	public function getSpecificLifetime() {
		return $this->_specificLifetime;
	}
	
	/**
	 * Return array with indexes:
	 * 	'useParams' => null|boolean
	 * 	'useUserId' => null|boolean
	 * 	'useLanguageId' => null|boolean
	 * 	'notcacheWhenUserLogged' => null|boolean
	 * 
	 * @return array
	 */
	public function getCacheIdRules() {
		return $this->_cacheIdRules;
	}
	
	/**
	 * @return array[]=>string When there is no tags, empty array is returned.
	 */
	public function getCacheTags() {
		return $this->_cacheTags;
	}
}